{% extends '@Admin/adminFramework/base/index.html.twig' %}
{% import '@Admin/adminFramework/loader/model.loader.twig' as loader_model %}
{% import "@Admin/adminFramework/loader/control.loader.twig" as loader_control %}

{% block css %}
    {{ parent() }}
    <style type="text/css">
        #print_content{
            width: 20.99cm;
            margin: auto;
            overflow: hidden;
            background-color: white;
            margin-bottom: 200px;
        }
        #print_content_a4{
            margin-top: 2cm;
            margin-left: 2.5cm;
            margin-bottom: 2cm;
            width: 16cm;
        }
        #description_div{
            margin-bottom: 20px;
            font-size: 16px;
        }
        #button_div{
            margin-bottom: 10px;
        }
        .unit-content{
            width: 100%;
        }
     </style>
{% endblock %}

{% block content %}
    {% block before %}
    {% endblock %}

    <div id="description_div">
        须知: 纸张大小需为A4
    </div>

    <div id="button_div">
        {{ loader_control.buttonSuccess('打印', 'id="print"') }}
        {{ loader_control.buttonDefault('返回上一页', 'id="return"') }}
    </div>

    <div id="print_content">
        <div id="print_content_a4">
            {% block print_content %}
            {% endblock %}
        </div>
    </div>

{% endblock %}

{% block jquery %}
    {{ parent() }}
    <script src="{{ asset('bundles/admin/js-manages/jQuery.print.js') }}"></script>
    <script>

        $('#return').click(function () {
            window.history.back(-1);
        });

        $('#print').click(function () {

            $('#print_content').print(
                {
                    "title": {% block print_title  %}null{% endblock %}, {#{% block print_title  %}"title"{% endblock %}#}
                    "globalStyles" : true,
                    "stylesheet": "{{ asset('bundles/admin/css-manages/print.css') }}",
                }
            );
        });
    </script>
{% endblock %}